import request from '@/utils/request';

/**
 * 添加标签分组
 * @param {Object} tagGroup
 * @return {void}
 */
export function add(tagGroup) {
  return request({
    url: '/txs/group_tags',
    method: 'post',
    data: tagGroup,
  });
}

/**
 * 修改标签分组
 * @param {Object} tagGroup
 * @return {void}
 */
export function update(tagGroup) {
  return request({
    url: '/txs/group_tags',
    method: 'put',
    data: tagGroup,
  });
}

/**
 * 删除标签分组
 * @param {string} groupName 分组名
 * @return {void}
 */
export function del(groupName) {
  return request({
    url: '/txs/group_tags',
    method: 'delete',
    params: { groupName },
  });
}

/**
 * 根据主键ID, 将标签从分组中删除
 * @param {number} id 主键ID
 * @return {Object}
 */
export function delTag(id) {
  return request({
    url: '/txs/group_tags/tag',
    method: 'delete',
    params: { id },
  });
}

/**
 * 分页查询标签分组
 * @param {Object} params 页码, 查询关键字等
 * @return {Object}
 */
export function getPage(params) {
  return request({
    url: '/txs/group_tags/page',
    method: 'get',
    params: params,
  });
}

/**
 * 查询所有性格标签
 * @return {Object}
 */
export function getXingGeTags() {
  return request({
    url: '/txs/group_tags/xingge',
    method: 'get',
  });
}

/**
 * 查询出分组中所有的标签
 * @param {string} groupName 分组名称
 * @return {Object}
 */
export function getGroupAllTags(groupName) {
  return request({
    url: '/txs/group_tags/tags',
    method: 'get',
    params: { groupName },
  });
}

/**
 * 查询所有标签分组
 * @return {Object}
 */
export function getAllGroups() {
  return request({
    url: '/txs/group_tags/groups',
    method: 'get',
  });
}
